package com.aynu.webshop.web.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.aynu.webshop.core.generic.GenericDao;
import com.aynu.webshop.core.generic.GenericServiceImpl;
import com.aynu.webshop.web.dao.GoodsMapper;
import com.aynu.webshop.web.model.Goods;
import com.aynu.webshop.web.service.GoodsService;
@Service
public class GoodsServiceImpl extends GenericServiceImpl<Goods, Integer> implements GoodsService {

	
	@Resource
	private GoodsMapper goodsMapper;
	
	@Override
	public int insert(Goods model) {
		// TODO Auto-generated method stub
		return goodsMapper.insertSelective(model);
	}

	@Override
	public int update(Goods model) {
		// TODO Auto-generated method stub
		return goodsMapper.updateByPrimaryKeySelective(model);
	}

	@Override
	public int delete(Integer id) {
		// TODO Auto-generated method stub
		return goodsMapper.deleteByPrimaryKey(id);
	}

	@Override
	public Goods selectById(Integer id) {
		// TODO Auto-generated method stub
		return goodsMapper.selectByPrimaryKey(id);
	}

	@Override
	public Goods selectOne() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Goods> selectList() {
		// TODO Auto-generated method stub
		return goodsMapper.findAll();
	}

	@Override
	public GenericDao<Goods, Integer> getDao() {
		// TODO Auto-generated method stub
		return goodsMapper;
	}
	
	@Override
	public int selectByCatcid(Integer catcid) {
		// TODO Auto-generated method stub
		return goodsMapper.findByCatcid(catcid);
	}

	@Override
	public List<Goods> selectListByCatcid(Integer catcid) {
		// TODO Auto-generated method stub
		return goodsMapper.findListByCatcid(catcid);
	}
}
